package com.deyang.adapter;

import android.app.Activity;
import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.deyang.entity.MailModel;
import com.deyang.entity.OrganizationModel;
import com.deyang.maillist.R;

import java.util.List;


/**
 * @author wangdyang
 * @createDate 2018年7月21日19:37:34
 * @desc 我的消息列表
 */
public class MailAdapter extends BaseQuickAdapter<MailModel, BaseViewHolder> {

    public MailAdapter(Activity activity, @Nullable List<MailModel> data) {
        super(R.layout.item_mail, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, MailModel item) {
        if ("1".equals(item.getSex())) {
            helper.setBackgroundRes(R.id.iv_sex, R.mipmap.default_mail_man);
        } else {
            helper.setBackgroundRes(R.id.iv_sex, R.mipmap.default_mail_wuman);
        }
        helper.setText(R.id.tv_name, item.getName());
        helper.setText(R.id.tv_duty, item.getDuty());
        if (TextUtils.isEmpty(item.getDuty())) {
            helper.setVisible(R.id.tv_duty, false);
        } else {
            helper.setVisible(R.id.tv_duty, true);
        }
    }
}
